package com.realjinge.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.realjinge.api.util.JsSignUtil;

/**
 * 
 * @author realjinge
 *
 */
@Controller
public class TestController {

	/**
	 * 
	 * @param request
	 * @param response
	 * @param map
	 * @return
	 */
	@RequestMapping(value = "test.do", method = { RequestMethod.GET,
			RequestMethod.POST })
	public String doTest(HttpServletRequest request,
			HttpServletResponse response, ModelMap map) {
		String url = request.getScheme() + "://" + request.getServerName()
				+ request.getRequestURI();
		System.out.println("doTest:\t" + url);

		Map<String, String> ret = new HashMap<String, String>();
		ret = JsSignUtil.sign(url);

		map.addAttribute("ret", ret);

		return "view/func";
	}
	
}
